Repository navigation
feat(record-page): each changed field is its own line under an activity entry, old → new - #36613
Conversation
…vity entry, old → new Claude-Session: https://claude.ai/code/session_01ADHkmPq6z7KER4Sr6Uu7Ht Co-authored-by: Claude <noreply@anthropic.com>
…he line, not one element Claude-Session: https://claude.ai/code/session_01ADHkmPq6z7KER4Sr6Uu7Ht Co-authored-by: Claude <noreply@anthropic.com>
…ell harness reads the lines Claude-Session: https://claude.ai/code/session_01ADHkmPq6z7KER4Sr6Uu7Ht Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmPq6z7KER4Sr6Uu7Ht Co-authored-by: Claude <noreply@anthropic.com>
…grid.summary.pattern Claude-Session: https://claude.ai/code/session_01ADHkmPq6z7KER4Sr6Uu7Ht Co-authored-by: Claude <noreply@anthropic.com>
…is a test) Claude-Session: https://claude.ai/code/session_01ADHkmPq6z7KER4Sr6Uu7Ht Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmPq6z7KER4Sr6Uu7Ht Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#2 · os-steve · session_01ADHkmPq6z7KER4Sr6Uu7Ht Contract-review-claim: session_01ADHkmPq6z7KER4Sr6Uu7Ht · head 633b84e · 2026-11-23T03:31Z |
|
repo:objectstack#2 · os-steve · session_01ADHkmPq6z7KER4Sr6Uu7Ht Contract reviewServed-tier: Face: declaration only ( ① Derived judgments
② Semver levelClause-②: yes (widening)
③ Boundary flags
Implemented-by: VERDICT: PASS |
|
repo:objectstack#2 · os-steve · session_01ADHkmPq6z7KER4Sr6Uu7Ht 席位核对ACCEPT — one card part, one PR, not governed (
Landing: not this thread's to do. Non-governed and under 3000 lines; reported to the seat with this head and the record ids. On merge, |
|
repo:objectstack#2 · os-steve · session_01ADHkmRY38EZf38Yy3zthbY 维护者速读
ACCEPT → PR #36613 comment 7090849791 · |
… write Field change values (objectstack-ai#36290 part 1) (objectstack-ai#36641) <!-- claude-projects-attribution: {"github_login":"os-steve"} --> _Requested by **Steve** · [project thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9NRmimMwnUgR1DbqgHtBWM3)_ Part of objectstack-ai#36290 Clause-②: yes (widening) Metadata-protocol: none ## 维护者速读 - 管理员在 Studio 的字段设置和字段设计器里,原来的「记录历史」开关换成「字段修改值」三选一(默认 / 开 / 关),对象设置的「功能开关」里新增「字段修改值」;普通用户无感。 - 属于记录页「字段修改前后值」专题,落实「默认显示、对象或单个字段可关」的裁决:以前 Studio 写的是不再起作用的旧开关,管理员在界面上关不掉前后值。 - 若出错,管理员可能看到「默认」标成开而动态里实际不显示前后值(或相反),或关掉后回不到默认;改动只在设置界面,可直接撤回。 - 要你做的:无。 ## What changes Card objectstack-ai#36290 part ① (PR 3 of 4; ruling 7076513167 point 1: "Old → new is shown by default on every object's record page; an object, or a single field, can turn it off."). PR 1 (objectstack-ai#36399) gave the runtime `fieldHistory` (field) and `enable.fieldHistory` (object); objectstack-ai#36580 gave the metadata form a three-way `field-history` widget. The Studio's own producers still wrote the old key. This PR moves all three named in the release comment. **Field inspector** (`ObjectFieldInspector.tsx`, Advanced section) - The "Track history" box (`value={!!def.trackHistory}`, `patchDef({ trackHistory: v || undefined })`) is gone. Measured reason: since PR 1 a field's `trackHistory: false` reads like absent and `true` does only what `fieldHistory: true` does for a media or JSON type (spec describe of `FieldSchema.trackHistory`), so a second box beside Field change values could only mislead. A stored `trackHistory` is never written or removed here; it is still read, because `resolveFieldHistory` reads it. - New row "Field change values": Default / On / Off over the field's `fieldHistory`. Default removes the key (`unsetDefKey`, not a patch to `undefined`); On / Off write `true` / `false`. - Default names what it resolves to through `resolveFieldHistory` from `@objectstack/spec/data`, the predicate the activity writer uses. Unlike the form widget, this rail holds the object document, so it passes the object: an object with `enable.fieldHistory: false` makes every field's Default read "Default (Off)", and a note under the row says the object's off wins. - The row sits inside the existing `DisplayPatchLock`, so on a read-only base field it is locked with the same reason as its neighbours (`fieldHistory` is not on `BASE_FIELD_DISPLAY_WHITELIST`). **Object settings** (`ObjectSettingsPanel.tsx`, Features card) - New row "Field change values" (`enable.fieldHistory`), next to "Field change history" (`enable.trackHistory`). Ticked unless the stored value is a literal `false`. Unticking writes `false`; ticking again REMOVES the key (unset already means on, so no `true` the author did not need). Sibling `enable` keys are kept, as for every other row. - The Field change history description no longer says "pair with per-field history tracking to pick which field diffs are summarized" (no longer true); it points to Field change values. **Field designer** (`plugin-designer` `FieldDesigner.tsx`, the drawer behind `MetadataFieldsPage` and the `field-designer` SDUI type) - The Advanced section's Track History switch wrote `trackHistory: data.trackHistory === true` on every save, create and edit. It is replaced by Field Change Values with the same three choices. The update path no longer names `trackHistory`: a stored value rides the `...editingField` spread, and a created field carries neither key at Default. - Default's label depends on the type, which the author can change in the same drawer, and a drawer select's options are static. So the choice is drawn as two rows under form-local names, one per resolved default, each shown by a `visibleWhen` built from `resolveFieldHistory` over `DESIGNER_FIELD_TYPES` (with the field's stored `trackHistory`). The save reads the row shown for the saved type, which is the one on screen at the click. Neither form-local name reaches the model. - `DesignerFieldDefinition` (`@object-ui/types`) and its zod mirror gain an optional `fieldHistory`. Both save paths carry it: `MetadataFieldsPage` (`toDesignerField` / `fromDesignerField`) and `MetadataService.toFieldPayload`. Default writes `fieldHistory: undefined`, which overrides the carried value and is dropped on the wire, so a stored key is removed. That is the converters' existing clear-by-absence rule. - It cannot import `fieldHistoryChoice.ts`, because app-shell depends on plugin-designer. What it shares is the rule (`resolveFieldHistory` from `@objectstack/spec/data`). Its own copy of the choice-to-value mapping is two lines. Its strings are the language-pack keys `appDesigner.fieldDesigner.fieldHistory`, `fieldHistoryDefault`, `fieldHistoryOn` and `fieldHistoryOff`, in all 11 locales and the designer's defaults table. They replace `appDesigner.fieldDesigner.trackHistory`. **Shared logic** (`metadata-admin/fieldHistoryChoice.ts`, new): the three choices, the value each writes and their wording, used by both the inspector row and the objectstack-ai#36580 `field-history` widget (refactored onto it; its behaviour and its 10 pins unchanged). The controls stay separate on purpose: the widget is a `WidgetProps` renderer that sees one form row and no object; the inspector row is an `InspectorSelectField` with the inspector's label and lock semantics and the whole object in hand. **Strings** (studio namespace, en + zh; the other locales fall back to en by that namespace's design): `designer.field.fieldHistory`, `designer.field.fieldHistoryObjectOff`, `engine.studio.settings.capFieldHistory`, `engine.studio.settings.capFieldHistoryDesc`; `engine.studio.settings.capTrackHistoryDesc` reworded; `designer.field.trackHistory` removed with its box. Not in this PR: record-page rows (part ②, landed as objectstack-ai#36613), the per-field history card (part ③). ## Tests - New `ObjectFieldInspector.fieldHistory-36290.test.tsx` (7): Default (On) for a one-line type; Default (Off) for image / json / password and Default (On) once `trackHistory: true`; Off writes `false`, On writes `true`; Default after Off removes the key; no Track history box, no `trackHistory` written, a stored one kept; the object's off makes Default (Off) and shows the note; control: no note otherwise. - New describe in `ObjectSettingsPanel.test.tsx` (4): checked for unset and `true`, unchecked only for `false`; untick writes `false` with siblings kept; re-tick removes the key with siblings kept; labelled by its own title. - New `FieldDesigner.fieldHistory-36290.test.tsx` (9), on the real `FieldDesigner` with a drawer double that captures its schema and calls its own `onSuccess`. The cases: two rows and no Track History row, with the labels; for every designer type exactly one row's `visibleWhen` evaluates true (through `evalFieldPredicate`, the form's own evaluator), and it is the one `resolveFieldHistory` names; a stored `trackHistory: true` moves a media type to the Default (On) row; an untouched edit writes neither key; Off writes `false`, On on a media type writes `true`; a stored `false` opens as Off and Default removes it; a stored `trackHistory` is kept; a type changed in the drawer saves what is on screen; a created field at Default carries neither key. - New `MetadataFieldsPage.fieldHistory-36290.test.tsx` (4), on PUT bytes through the real page and a real `MetadataClient`. A stored `fieldHistory: false` survives and no `trackHistory` is written; a stored `trackHistory: true` survives and gains no `fieldHistory`; a field with neither key gains neither; every PUT field parses through `FieldSchema`. - Extended: `MetadataService.fieldKeyCarryOver.test.ts` adds `fieldHistory` to its populated entry and its clearable keys; `designer-zod-arms-10859.test.ts` adds `fieldHistory` to the fully populated `field-designer` document. - Forced test changes: `ObjectFieldInspector.displayPatchReason-28986.test.tsx` names the Field change values combobox instead of the removed Track history checkbox among the locked controls; `ObjectSettingsPanel.businessWording-36512.test.tsx` lists `enable.fieldHistory` among the keys the tab writes. `ObjectFieldInspector.externalIdNotOffered-26674.test.tsx` and `ObjectFieldInspector.retiredIndexed.test.tsx` listed Track history among the Advanced siblings that still render; they name Field change values, and (being edited) now pay the formula and lint loads at module top, as `check:test-source-alias` requires. `FieldDesigner.externalIdNotOffered-26674.test.tsx` and `MetadataFieldsPage.externalIdRoundTrip-26674.test.tsx` used the Track History row as their positive control; they now use the Field Change Values row. ## Acceptance notes - The field designer's Default label follows the drawer's type and the object is not in hand, so an object with `enable.fieldHistory: false` is not reflected there, the same accepted bound as objectstack-ai#36580's widget. Neither `FieldDesigner` nor `MetadataFieldsPage` is mounted by the Console today; both are published exports, and `field-designer` is a registered SDUI type. - A stored field `trackHistory: true` on a media or JSON type makes Default read "Default (On)"; such a field can still be turned off with Off, but not returned to the type's off-by-default without editing the key in the form. That is the resolver's answer, not a UI choice. - `ui/AGENTS.md` objectstack-ai#2 (package README and `content/docs/frontend/` page) not edited: outside this part's file surface. - Screenshots NOT MEASURED (no Console build or backend run here). ## Verification Read first, by risk: 1. `ui/packages/plugin-designer/src/FieldDesigner.tsx`: the `fieldHistoryRows` memo (two rows, `visibleWhen` built from `resolveFieldHistory`) and `fieldHistoryFromForm`, which picks the row for the SAVED type on both save paths. 2. `ui/packages/app-shell/src/views/studio-design/ObjectSettingsPanel.tsx`: `patchEnable` with `unsetWhenOn` (re-ticking removes `enable.fieldHistory`, keeps siblings). 3. `ui/packages/app-shell/src/views/metadata-admin/inspectors/ObjectFieldInspector.tsx`: the Field change values row and the object-off note inside `DisplayPatchLock`. Two-minute check: open Studio, an object, Settings, Features: "Field change values" is ticked. Untick, save, and reopen the object JSON: it shows `enable.fieldHistory: false`. Tick again: the key is gone. Then open a field's Advanced section: "Field change values" reads "Default (Off)" with the note under it. <details><summary>Runs (local, head 3b5b130 after merging origin/main 9e2a4ac)</summary> - Builds under the verify lock: the `@objectstack/{spec,formula,lint,client,sdui-parser}` closure, and `@object-ui/app-shell^...` again after the merge (VERDICT command-exit 0 each). - `type-check` (tsc plus `tsconfig.test.json`) of `@object-ui/app-shell`, `@object-ui/i18n`, `@object-ui/types` and `@object-ui/plugin-designer`: all four Done, exit 0 (after the merge; plugin-designer again at 3b5b130). - Post-merge union at ffa608d: `vitest run packages/app-shell/src/views/metadata-admin/inspectors/ packages/app-shell/src/views/studio-design/ObjectSettingsPanel packages/app-shell/src/views/metadata-admin/FieldHistoryWidget-36482.test.tsx packages/app-shell/src/views/metadata-admin/SchemaForm packages/plugin-designer/ packages/types/ packages/app-shell/src/services/ packages/i18n/ packages/app-shell/src/__tests__/defaults-maps-mirror-en-pack.test.tsx` gave Test Files 851 passed (851) and Tests 16838 passed, 14 skipped. 3b5b130 changes only the designer pin's types; that file re-run: 9/9. - Pre-merge union at 3fa510b (`metadata-admin/`, `studio-design/`, `i18n/`) gave Test Files 1232 passed and 2 failed (1234). The 2 were sibling pins still naming Track history, fixed in 58cef60. - Ablations, each through `scripts/ablation-replace.mjs` (anchor 1 to 0), restored with blob equal to HEAD and `git diff HEAD` empty: - The inspector writes `trackHistory` again: 2 of 7 new inspector pins red. - The settings switch writes `true` instead of removing the key: 1 of 14 red. - The designer's update path writes `trackHistory: data.trackHistory === true` in place of `fieldHistory`: 7 of 13 red across the two new designer files. - `dispatch-gates --commands` at 3b5b130 derived 42 families; all 42 ran locally with exit 0; `--ran` reconciliation gives "42 derived, 42 run, 0 NOT-MEASURED, 0 UNRUN". - `overlap-check` at 3b5b130: VERDICT clean exit 0 against origin/main d7411fa (three commits past the merged 9e2a4ac; `git merge-tree` is also clean) and objectstack-ai#36634, objectstack-ai#36629, objectstack-ai#36606, objectstack-ai#36587, objectstack-ai#36525. - ui extras: `check:new-line-citations` 0, `check:i18n-keys` 0, `check:i18n-drift` 0, `check:i18n-dead-keys` 0. eslint on the changed source and test files: 0 errors, and no warnings on added lines. </details> 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01ADHkmPq6z7KER4Sr6Uu7Ht --------- Co-authored-by: Claude <noreply@anthropic.com>
Requested by Steve · project thread
Part of #36290
Clause-②: yes (widening) — four new
detail.*language-pack keys in every locale@object-ui/i18nships, and new optional props on the exportedFieldChangeItem; nothing removed or renamedMetadata-protocol: none
PR 2 of 4 on the card (part ②: card items 1 and 2, and the activity half of item 5). PR 1 (#36399, merged as
70194ffc) made the activity stream serve each changed field's old and new values, narrowed per reader. This PR draws them on the record page. Part ① (the designer producers offieldHistory) waits for #36580; part ③ (the per-field history card and the field and grid-cell entry points) closes the card. Ruling-ref: 7076513167.维护者速读
What changes
The served values reach the timeline (
ui/packages/plugin-detail/src/renderers/recordActivityFeed.ts)activityFieldChangesOf(row): reads the field-change code plugin-audit serves insys_activity.metadata(summary_message, keyfieldChanges) and turns it into oneFieldChangeEntryper field.activityRowToFeedItemputs it on the item asfieldChanges. An option side keeps the option it matched; a yes/no side keeps the boolean; the writer's empty mark (∅, or an empty text) becomes an empty side. A code it cannot read whole gives nothing, and the row draws its summary as before.activity-field-redaction.ts). The timeline draws exactly the changes it is handed.One line per changed field (
RecordActivityTimeline.tsx,FieldChangeItem.tsx)Label: old → new.Updated Phone, Email(its stored summary would repeat the lines). An activity row carrying its paired audit entry keeps its own summary. The record's creation is unchanged (one row, values beside the summary).fieldOptionLabel, falling back to the schema label, then the served text); a lookup or user reads as the record name the server served; a yes/no reads ascommon.yes/common.no; an empty side asdetail.fieldChangeEmpty.truncate). A side that overflows (measured), holds a line break, or is longer than 48 characters offersShow all, which wraps both sides in full, andShow less.data-stream-row,data-stream-system-row) sit on the whole entry (the line plus its field lines), so a reader of the row reads both; the 30 px line isdata-stream-line.Status: New → Contacted, where it readStatus New → Contactedwith—for empty.FieldChangeItem(exported, previously unused) is the line: new optionallabel,oldText/newText,emptyLabel,expandLabel/collapseLabel; with none of them it draws as before except the arrow is text and the empty word defaults to(empty).Language packs (
ui/packages/i18n/src/locales/*.ts, 11 locales;useDetailTranslation.tsdefaults mirroren)detail.fieldChangeLabel({{field}}:; fullwidth colon in zh-Hans, zh-Hant, ja;{{field}} :in fr),detail.fieldChangeEmpty(Empty,空),detail.fieldChangeExpand(Show all,展开),detail.fieldChangeCollapse(Show less,收起).Tests
New pins, as top-level describes in the existing harness files:
renderers/__tests__/record-activity.test.tsx—record:activity — one line per changed field, old → new (objectstack#36290): one field (Customer notes: Old words → New words); phone and email in one save is ONE row with two lines; empty side readsEmpty, never∅; select, lookup, user and yes/no read as option label, record names and words; only the served changes draw (a field left out of the code has no line); a long value truncates and toggles; the stream fold opens to each save's own lines; CONTROL: a short value has no toggle, and a row with no code draws its summary.renderers/__tests__/recordActivityFeed.test.ts—activityFieldChangesOf: mapping of text, option, boolean and the empty mark; the item carries the changes beside its summary; no code, another code, an empty or unreadable code give nothing.Forced test changes (each because the line format moved from
Label old → newon one element toLabel: old → newdrawn over several elements):__tests__/recordTimelineStream-27055.test.tsx: achangeLines()reader over[data-field-change]; the sixgetByText(/… → …/)matches read it instead (a text matcher cannot see a line split over spans). The negativequeryByText(/New → Contacted/)was moved too, since it would have become vacuous. The two creation-diff strings gain the colon.__tests__/RecordTimelinePanel-27524.test.tsx: the peek line readsStatus: New → Contacted.ui/packages/app-shell/src/views/RecordDetailView.harness.test.tsx: the audit-date and currency diff readers read[data-field-change]lines, and their expected strings gain the colon (Close date: 3.3.2020 → 4.3.2020,Amount: €1,500.00 → €2,500.00). The values themselves are unchanged.ui/packages/i18n/src/__tests__/untranslated-identity-4376.test.ts:detail.fieldChangeLabeljoinsLEGITIMATE_IDENTITIESas a format string (ko/ru/ar keep:), likegrid.summary.pattern.The permission half is the server's, pinned by PR 1 in
packages/plugins/plugin-audit/src/activity-field-redaction.test.ts([#36290] masked: …,[#36290] not served: the code and the summary are served without the change of the field not served,[#36290] control: a reader served every field is served the whole code). This PR adds the UI side: the timeline draws only what is served.Acceptance notes
{{field}}:). 「一次保存同时改电话和邮箱:一条动态,下面两行。」 — yes. 「单选、关联记录、人员字段:前后值显示的是选项名和记录名,不是内部编号。」 — yes for single select, lookup and user (option label read per reader; record names as served). 「用一个没有某字段读取权限的账号:动态里没有那个字段的修改行」 — the server leaves the change out (PR 1); the UI draws what is served. The 「修改历史」 half of that line is part ③.OS_PORT=3000 pnpm dev, open a showcase record, edit a long text field and, in one save, two short fields; the record's 动态 tab shows one entry per save with one line per field; a long value showsShow all.∅(or an empty text), the notation plugin-audit'ssummaryValueOfwrites and its tests pin; the served code carries no separate empty mark. A structural mark would be a server change, outside this PR.treesides still read as the stored text the writer wrote (PR 1 nits, not taken there either).ui/AGENTS.md✨ Set up Copilot instructions #2 asks for the package README and thecontent/docs/frontend/page; both are outside this dispatch's file surface, so neither is edited here.Verification
Read first:
ui/packages/plugin-detail/src/renderers/recordActivityFeed.ts—activityFieldChangesOf(the only new read of server data; the empty mark).ui/packages/plugin-detail/src/RecordActivityTimeline.tsx—fieldChangeLinesOf,changeSideText, andrenderSystemLine(which entries get lines, and the row-marker move instreamRow).ui/packages/plugin-detail/src/FieldChangeItem.tsx— truncation, the measured overflow and the toggle.Two-minute check:
pnpm --dir ui exec vitest run packages/plugin-detail/src/renderers/__tests__/record-activity.test.tsx— expect 35 passed, among them the eightone line per changed fieldtests.Readings below are at head
f281417b(after mergingorigin/mainonce).Tests (local, under the verify lock)
pnpm --dir ui exec vitest run packages/plugin-detail/ packages/i18n/ packages/app-shell/src/__tests__/defaults-maps-mirror-en-pack.test.tsxplus the 22 app-shellRecordDetailView.*/ record-page activity test files, atf281417b:Test Files 543 passed | 1 skipped (544),Tests 6159 passed | 31 skipped (6190), lockVERDICT command-exit 0.pnpm --filter @object-ui/plugin-detail run type-checkandpnpm --filter @object-ui/i18n run type-check(eachtsc --noEmit && tsc -p tsconfig.test.json; the test project lists the four edited test files): exit 0, before the merge.ui:check:i18n-keys0,check:i18n-drift0,check:i18n-dead-keys0,check:new-line-citations0 (0 new citation(s)), before the merge.Ablation
Committed head first, then
node scripts/ablation-replace.mjsreplacedconst lines = fieldChangeLinesOf(item);inrenderSystemLinewithconst lines = null …(anchor 1 → 0, blob5cc789c3a1d9→0061c6cdd8de) and ranrecord-activity.test.tsxunder the lock:Tests 8 failed | 27 passed (35)— all eightone line per changed fieldtests red, every older test green. Restored: blob after restore5cc789c3a1d9== HEAD,git diff HEADempty. Nodistis involved: the ui vitest config aliases@object-ui/plugin-detailto its source.Gates
node scripts/pm/dispatch-gates.mjs --commandsatf281417b: 41 commands, each run with its exit code recorded before any pipe; all 41 exit 0.--ran:Run reconciliation — 41 derived, 41 run, 0 NOT-MEASURED, 0 UNRUN.CI owns the rest (Lint UI, Type Check UI, Test UI, the repo-wide lint); not re-run here.🤖 Generated with Claude Code
https://claude.ai/code/session_01ADHkmPq6z7KER4Sr6Uu7Ht